<template>
    <div class="parent">
        <h1>我是父亲</h1>
        <h2>{{msgFromChild}}</h2>
        <child @getMoney="getMsgFromChild"></child>
    </div>
</template>

<script>
import Child from '@/components/Child.vue'
export default {
    data(){
        return{
            msgFromChild:''
        }
    },
    components:{
        Child
    },
    methods:{
        getMsgFromChild(msg){
            console.log(msg);
            this.msgFromChild=msg;
        }
    }
}   
</script>
// scoped表示该样式只能在该组件中使用，不能影响其他组件
<style scoped>
    .parent{
        width: 500px;
        height: 500px;
        background-color: springgreen;
    }
</style>